/*
 * Problem: 指派问题（Assignment）
 * Author: Yuanshun L
 * Created: 28-Nov-2021
 * Topic: Ford-Fulkerson算法
 */

#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;

struct edge{
    int to,cap,rev;
    edge(int to=-1,int cap=-1,int rev=-1):to(to),cap(cap),rev(rev){}
};
const int maxn = 1000 + 5;
const int inf = 100000000;
vector<edge> G[maxn];
bool used[maxn];

void add_edge(int from,int to,int cap){
    G[from].push_back(edge(to,cap,G[to].size()));
    G[to].push_back(edge(from,0,G[from].size()-1));
}

void build_graph(){
    int n,f,t,c;
    cin >> n;
    while(n--){
       cin >> f >> t >> c;
       add_edge(f,t,c);
    }
}

int dfs(int u,int v,int f){
    if(u == v)
        return f;
    int d;
    used[u] = true;
    for(int i=0;i<G[u].size();i++){
        edge &e = G[u][i];
        if(!used[e.to] && e.cap > 0){
            d = dfs(e.to,v,min(e.cap,f));
            if(d>0){
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s,int v){
    int res = 0;
    int d;
    while(true){
        memset(used,0,sizeof(used));
        d = dfs(s,v,inf);
        if(d == 0){
            return res;
        }
        res += d;
    }
}


int N,K;
bool can[maxn][maxn];// can[i][j] := compute i can reach task j

void solve(){
    // read data
    int n; // edge number
    cin >> N >> K >> n;
    int u,v;
    memset(can,0,sizeof(can));
    while(n--){
       cin >> u >>v;
       can[u][v] = true;
    }

    // connect
    int s = N+K, t = s+1; // start , target
    for(int i=0;i<N;i++){ // connect the start point with all computes
        add_edge(s,i,1);
    }
    for(int i=0;i<K;i++){ // inversely connect the end point with all tasks
        add_edge(i+N,t,1);
    }
    for(int i=0;i<N;i++){ // add edges between computes and tasks
        for(int j=0;j<K;j++){
            if(can[i][N+j])
                add_edge(i,N+j,1);
        }
    }

    // input
    cout << "The Largest Matching Number : " << max_flow(s,t) << endl;

}

int main(){

    freopen("data.in","r",stdin);
    freopen("data.out","w",stdout);
    solve();

    return 0;

}
